using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteAlways]

public class ReserveNormals : MonoBehaviour
{
	// Start is called before the first frame update
	void Start()
	{

		GameObject defaults = GameObject.Find("default");

		List<Vector3> normals = new List<Vector3>();
		defaults.GetComponent<MeshFilter>().sharedMesh.GetNormals(normals);

		Debug.Log(normals.Count);
		for (int i = 0; i < normals.Count; i++)
		{
			normals[i] = -normals[i];
		}
		defaults.GetComponent<MeshFilter>().sharedMesh.SetNormals(normals);

		int[] triangles = defaults.GetComponent<MeshFilter>().sharedMesh.triangles;
		for (int i = 0; i < triangles.Length; i += 3)
		{
			int t = triangles[i];
			triangles[i] = triangles[i + 2];
			triangles[i + 2] = t;
		}
		defaults.GetComponent<MeshFilter>().sharedMesh.triangles = triangles;
	}


	// Update is called once per frame
	void Update()
	{

	}
}
